package com.zrf.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zrf.dao.impl.UserDaoImpl;
import com.zrf.pojo.User;

@Service("userService")
public class UserService {
	@Autowired
	private UserDaoImpl udi = null;
	
	public boolean login(String name, String pwd){
		boolean is = false;
		User u = new User();
		try {
			u.setUname(name);
			u.setUpassword(pwd);
			u = udi.findForObject(u);
			if (u!=null&&u.getUid()!=null) {
				is = true;
			}
		} catch (Exception e) {
			// TODO Auto-generated catch block

			e.printStackTrace();
		}
		return is;
	}

	public User getUserByName(String name) {
		// TODO Auto-generated method stub

		return udi.getUserByName(name);
	}
	
}